<?php
namespace app\admin\controller;
class Awardfuwu extends Base
{
    //列表
    public function lists(){
        if(is_post()){
            $d = $this->post;
            $map = [];
            if($d['keyword']!=''){ $map[] = ['and','a.order_no|b.username|a.s_id','like',"%{$d['keyword']}%"]; }
            if($d['min_time']!='') $map[] = ['and','a.create_time','>=',strtotime($d['min_time'])];
            if($d['max_time']!='') $map[] = ['and','a.create_time','<=',strtotime($d['max_time'])];

            $w  = where($map);
            $sql = "
            select
                a.*,b.username
            from
                award_fuwu a
            left join
                user b
            on
                a.user_id = b.id
            $w[0]
            order by a.id desc".limit($d['page'],$d['limit']);
            $rs = $this->db->query($sql, $w[1],'',true);

            if($rs){
                $rule = [
                    'create_time' => 'com_time_format',
                ];
                $rs[0] = com_format($rs[0],$rule);
                suc($rs[0],$rs[1]);
            }else{
                suc([],0);
            }
            $this->fetch();
        }
        return $this->fetch();
    }

}
?>
